import Vue from "vue";
import Router from "vue-router";
const _import = require("./_import_" + process.env.NODE_ENV);
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading
Vue.use(Router);

/* layout */
import Layout from "../views/layout/Layout";

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will no redirct in the levelbar
 * noDropdown : if `noDropdown:true` will has no submenu
 * meta : { role: ['admin'] }  will control the page role
 **/
export const constantRouterMap = [{
  path: "/",
  component: Layout,
  redirect: "/pages/bigData3/steelRingData",
  name: "首页",
  meta: {
    role: [
      "admin",
      "zhdMWKJ",
      "zhdDC",
      "zhdFlh",
      "zhdJK",
      "zhdCYY",
      "zhdRM",
      "zhdXZ",
      "zhdXRXBB",
      "zhdSJFWB",
      "zhdCWB"
    ]
  },
  hidden: true
}];

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
});

export const asyncRouterMap = [{
  path: "/pages/bigData3",
  component: Layout,
  redirect: "/pages/bigData3/gq",
  name: "钢圈经营数据",
  icon: "zonghe",
  meta: {
    role: ["admin", "zhdGQ"]
  },
  children: [
    //   {
    //   path: "indexOut",
    //   icon: "round",
    //   hidden: true,
    //   component: _import("pages/bigData3/gq/indexOut"),
    //   name: "驾驶舱（对外）",
    //   meta: {
    //     role: ["admin", "zhdGQ"]
    //   }
    // },
    // {
    //   path: "indexIn",
    //   icon: "round",
    //   hidden: true,
    //   component: _import("pages/bigData3/gq/indexIn"),
    //   name: "驾驶舱",
    //   meta: {
    //     role: ["admin", "zhdGQ"]
    //   }
    // },
    // {
    //   path: "sellAnalysis",
    //   icon: "round",
    //   component: _import("pages/bigData3/gq/sellAnalysis"),
    //   name: "运营分析",
    //   meta: {
    //     role: ["admin", "zhdGQ"]
    //   }
    // },
    {
      path: "steelRingData",
      icon: "round",
      component: _import("pages/bigData3/gq/steelRingData"),
      name: "钢圈网DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "depotData",
      icon: "round",
      component: _import("pages/bigData3/gq/depotData"),
      name: "钢圈仓库DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "transportData",
      icon: "round",
      component: _import("pages/bigData3/gq/transportData"),
      name: "浩德智运DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "supplyChainData",
      icon: "round",
      component: _import("pages/bigData3/gq/supplyChainData"),
      name: "供应链金融DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "selfShops",
      icon: "round",
      component: _import("pages/bigData3/gq/selfShops"),
      name: "自营店铺DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    }
  ]
},
{
  path: "/errlog",
  component: Layout,
  redirect: "noredirect",
  name: "errlog",
  icon: "bug",
  hidden: true,
  noDropdown: true,
  children: [{
    path: "log",
    component: _import("errlog/index"),
    name: "错误日志"
  }]
},
{
  path: "*",
  hidden: true,
  component: _import("errorPage/404")
}
];
